import { Module } from '@nestjs/common';
import { DbService } from './db.service';
import { TypegooseModule } from 'nestjs-typegoose';
import { User } from './models/user.model';
import { Action } from './models/action.model';
import { Attribute } from './models/attribute.model';
import { Banner } from './models/banner.model';
import { Category } from './models/category.model';
import { Comment } from './models/comment.model';
import { Commodity } from './models/commodity.model';
import { Order } from './models/order.model';
import { Permission } from './models/permission.model';
import { Role } from './models/role.model';
import { Selle } from './models/selle.model';
import { Service } from './models/service.model';

const model = TypegooseModule.forFeature([
  User,
  Action,
  Attribute,
  Banner,
  Category,
  Comment,
  Commodity,
  Order,
  Permission,
  Role,
  Selle,
  Service,
])

@Module({
  imports: [
    TypegooseModule.forRoot("mongodb://localhost:27017/nest-test2", {
      useNewUrlParser: true,
      useUnifiedTopology: true
    }),
    model
  ],
  providers: [DbService],
  exports: [model],
})
export class DbModule {}
